package com.yan.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("user")
public class LoginController {

    @RequestMapping("main")
    public String main(){
        return "main";
    }

    @RequestMapping("goLogin")
    public String goLogin(){
        return "login";
    }


    @RequestMapping("login1")
    public String login(HttpSession session, String name, String password, Model model){
        System.out.println("====="+name);
      session.setAttribute("userloginInfo",name);

        model.addAttribute("name",name);
        return "main";
    }

    @RequestMapping("goOut")
    public String goOut(HttpSession session){

           //清除session的消息
        session.removeAttribute("userloginInfo");


        return "main";
    }



}
